loginApp.controller('homeController', function($scope, loginService, oDbidService) {

    $scope.loggedIn = loginService.isAuthenticated();

    $scope.graphics = [];

    $scope.addGraphic = function() {
        oDbidService.query(function(dbids) {
            $scope.graphics.push({
                id: $scope.graphics.length,
                parameters: {
                    visible: true,
                    dbids: dbids,
                    name: "Parametrage du graphique",
                    selectedDbid: "",
                    dateDebut: "",
                    dateFin: "",
                    plageHoraire: false,
                    heureDebut: "",
                    heureFin: "",
                    plageJour: false,
                    lundi: false,
                    mardi: false,
                    mercredi: false,
                    jeudi: false,
                    vendredi: false,
                    samedi: false,
                    dimanche: false,
                },
                chart: {
                    name: "chart"
                }
            });
        });

    };

    $scope.toggleParameters = function(i) {
        $scope.graphics[i].parameters.visible = !$scope.graphics[i].parameters.visible;
    };
});